package com.demo.order.controller;

import com.demo.order.service.OrderBusinessService;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class OrderController {

    @Resource
    private OrderBusinessService orderBusinessService;

    @Resource
    private DiscoveryClient discoveryClient;

    @RequestMapping("/findOrder")
    public String findOrder() {
        return "I am order";
    }

    @RequestMapping("/findOrderSupplier")
    public String findOrderSupplier() {
        String orderSupplier = orderBusinessService.findOrderSupplier();
        return orderSupplier;
    }

    @RequestMapping("/findService")
    public Object findService() {
        List<String> clientServices = discoveryClient.getServices();
        return clientServices;
    }
}
